package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.UserRole;
import com.example.demo.entity.dto.GiveRolesDto;
import com.example.demo.enums.StatusCodeEnum;
import com.example.demo.exception.CustomException;
import com.example.demo.service.UserRoleService;
import com.example.demo.mapper.UserRoleMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
* @author admin
* @description 针对表【user_role(用户角色表)】的数据库操作Service实现
* @createDate 2024-01-08 10:33:40
*/
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService{

    @Override
    public Integer deleteByUserId(Long uid) {
        QueryWrapper<UserRole> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("uid",uid);
        return baseMapper.delete(queryWrapper);
    }

    @Override
    public Integer deleteByRoleId(Long rid) {
        QueryWrapper<UserRole> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("rid",rid);
        return baseMapper.delete(queryWrapper);
    }
}




